package com.lxy.demo.dao;

import com.lxy.demo.bean.User;
import com.lxy.demo.utils.DruidMannger;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

public class UserDaoImpl implements UserDao{

    QueryRunner qr = new QueryRunner(DruidMannger.getDataSource());
    @Override
    public User findUser(String name, String pwd) throws Exception{
        String sql = " select * from users where username = ? and `password` = ? ";
        return qr.query(sql, new BeanHandler<User>(User.class),name,pwd);
    }
}
